﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;
using wcfServiceLib;

namespace wcfSelfHosting
{
	class Program
	{
		static void Main(string[] args)
		{
			var host = new System.ServiceModel.ServiceHost(typeof(Service1), new Uri[] { new Uri("http://localhost:80/") });

			var b = host.Description.Behaviors.Find<ServiceMetadataBehavior>();
			if (b == null) b = new ServiceMetadataBehavior();
			host.Description.Behaviors.Add(b);

			host.AddServiceEndpoint(typeof(IService1), new WSDualHttpBinding(), "Usluga");
            host.AddServiceEndpoint(typeof(IService1), new BasicHttpBinding(), "http://192.168.0.10:8001/uslugawp");
			host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName,
				MetadataExchangeBindings.CreateMexHttpBinding(), "mex");

			host.Open();
			Console.WriteLine("Aby zakończyć działanie serwera proszę nacisnąć klawisz.");
			Console.ReadKey();
			host.Close();
		}
	}
}
